package com.modbus.config;

/**
 * @author heyayun
 * @description modbus配置
 * @date 2021/3/22 17:37
 */
public class ModbusMasterConfig {
    private final String address;
    private final int port;

    public ModbusMasterConfig(String address, int port) {
        this.address = address;
        this.port = port;
    }

    public String getAddress() {
        return this.address;
    }

    public int getPort() {
        return this.port;
    }

    public static Builder builder(String address){
        return new Builder(address);
    }

    public static class Builder {
        private final String address;
        private int port;

        public Builder(String address) {
            this.address = address;
        }
        public ModbusMasterConfig.Builder setPort(int port) {
            this.port = port;
            return this;
        }
        public ModbusMasterConfig build() {
            return new ModbusMasterConfig(this.address, this.port);
        }
    }
}
